package com.lsk.servicePassengerUser.controller;

import com.lsk.internalcommon.DTO.ResponseResult;
import com.lsk.internalcommon.request.VerificationCodeDTO;
import com.lsk.servicePassengerUser.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/user")
    public ResponseResult loginOrRegister(@RequestBody VerificationCodeDTO verificationCode){


        return  userService.loginOrRegister(verificationCode.getPassengerPhone());
    }

    @GetMapping("/user/{passengerPhone}")
    public ResponseResult getUserByPhone(@PathVariable String passengerPhone){

        return userService.getUserByPhone(passengerPhone);
    }
}
